package com.aliyun.heiyu.powermaster.server.dao.impl;

import com.aliyun.heiyu.common.util.JdbcUtil;
import com.aliyun.heiyu.powermaster.server.dao.DictionaryConfigDao;
import org.apache.commons.lang3.StringUtils;

import java.util.Map;

public class DictionaryConfigDaoImpl implements DictionaryConfigDao {

    @Override
    public String getValue(String key) {
        String sql = " select `value` from  dictionary_config  where `key`=?";
        Object[] params = new Object[1];
        params[0] = key;
        Map<String, String> map = JdbcUtil.queryForMap(sql, params);
        if(map == null|| StringUtils.isBlank(map.get("value"))){
            return "";
        }
        return map.get("value");
    }
}
